package com.ddd.demo.lee.数组;

public class 盛最多水的容器 {

    public static int maxArea(int[] height){
        int maxarea =0;
        int l = 0;
        int r = height.length - 1;

        while (l<r){
            maxarea = Math.max(maxarea,Math.min(height[l], height[r]) * (r - l));
            if(height[l] < height[r]){
                l++;
            }else{
                r--;
            }
        }
        return maxarea;
    }

    public static void main(String[] args) {
        int[] height = new int[]{1,1};

        int result = maxArea(height);

        System.out.println("result = " + result);

    }

}
